<?php
declare(strict_types=1);

namespace App\Site\Rpc;

use App\Site\Contract\SiteServiceInterface;
use App\Site\Service\SiteInfoService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\RpcMultiplex\Constant;
use Hyperf\RpcServer\Annotation\RpcService;

#[RpcService(name: "SiteService", server: "rpc", protocol: Constant::PROTOCOL_DEFAULT)]
class SiteService implements SiteServiceInterface
{
    /**
     * @var SiteInfoService
     */
    #[Inject]
    protected SiteInfoService $siteInfoService;

    public function findByUuid(string $uuid): array
    {
        return $this->siteInfoService->findByUuid($uuid)->toArray();
    }

    public function findBySiteId(int|string $siteId): array
    {
        return $this->siteInfoService->findBySiteId($siteId)->toArray();
    }
}